package com.example.feignconsumer.controller;

import com.example.api.domain.Person;
import com.example.feignconsumer.service.HelloService;
import org.apache.catalina.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * FeignClient测试控制器
 * @date 2019-4-18 14:58:30
 * @author joker
 */
@RestController
@RequestMapping("/feign/client")
public class ConsumerController {

    @Resource
    private HelloService helloService;

    @GetMapping("/hello")
    public String helloConsumer(){
        return helloService.hello();
    }

    @GetMapping("/hello/test")
    public String helloTest(){
        StringBuilder sb = new StringBuilder();
        sb.append(helloService.hello());
        sb.append(helloService.hello("yangyang"));
        sb.append(helloService.hello("yangyang",26));
        sb.append(helloService.hello(new Person(1, "yangyang", 26)));
        return sb.toString();
    }
}
